package singleStep;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.File;
import java.io.IOException;

import static utils.JsonMap.processChainNodes;


public class JsonChainFunctionAdder {
    /**
     * 方法调用链衔接
     */
    public static void main(String[] args) throws IOException {
        String inputFile = "D:\\code\\hdfork\\archguard\\server\\dependencies\\codeCrop.json";
        String outputFile = "D:\\code\\hdfork\\archguard\\server\\dependencies\\outputChain.json";

        ObjectMapper mapper = new ObjectMapper();
        JsonNode root = mapper.readTree(new File(inputFile));

        processChainNodes(root, root); // 根节点既是遍历起点也是顶层节点

        mapper.writerWithDefaultPrettyPrinter().writeValue(new File(outputFile), root);
    }


}